#ifndef MUSIC_PLAYER_H
#define MUSIC_PLAYER_H

#include <QMediaPlayer>
#include <QNetworkAccessManager>
#include <QWidget>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonValue>

namespace Ui {
class music_player;
}

class music_player : public QWidget
{
    Q_OBJECT

public:
    explicit music_player(QWidget *parent = nullptr);
    ~music_player();

    QVector<QUrl>play_list;
    int current_music = 0;
    QNetworkAccessManager* http;
    QMediaPlayer *player;
    QAudioOutput* audioOutput;

    void send_request();
    void handle_request(QNetworkReply *reply);

    void onStateChanged(QMediaPlayer::MediaStatus state);
private:
    Ui::music_player *ui;
};

#endif // MUSIC_PLAYER_H
